package com.tangyuan.live.controller;

import com.tangyuan.common.result.Result;
import com.tangyuan.live.entity.vo.LiveRoomVo;
import com.tangyuan.live.service.LiveViewRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("live/record")
public class LiveViewRecordController {

    @Autowired
    LiveViewRecordService liveRecordService;

    /**
     * 用户加入直播
     * @param roomId 直播间Id
     * return 直播间内容
     */
    @PostMapping("/inOrOutLive")
    public Result<LiveRoomVo> inOrOutLive(@RequestHeader("Authorization") String token, @RequestParam Long roomId){
        return liveRecordService.inOrOutLive(token,roomId);
    }

    /**
     * 在线人数
     * @param roomId 直播间Id
     * return 直播间在线人数
     */
    @GetMapping("/getOnLineNumber")
    public Result<Long> getOnLineNumber(@RequestParam Long roomId){
        return liveRecordService.getOnLineNumber(roomId);
    }



}
